package com.lixl.example.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @GetMapping("/index")
    public String index(){

        return "hello nacos";
    }

    @GetMapping("/user/{id}")
    public JSONObject getUserById(@PathVariable("id") String id){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("id", id);
        jsonObject.put("name", "name-"+id);
        return jsonObject;
    }

}
